19
+      agent.options['user_agent'] = ""
20
+      agent.should be_valid
21
+
22
+      agent.options['user_agent'] = "foo"
23
+      agent.should be_valid
24
+
25
+      agent.options['user_agent'] = ["foo"]
26
+      agent.should_not be_valid
27
+
28
+      agent.options['user_agent'] = 1
29
+      agent.should_not be_valid
30
+    end
31
+
32
+    it "should validate headers" do
33
+      agent.options['headers'] = "blah"
34
+      agent.should_not be_valid
35
+
36
+      agent.options['headers'] = ""
37
+      agent.should be_valid
38
+
39
+      agent.options['headers'] = {}
40
+      agent.should be_valid
41
+
42
+      agent.options['headers'] = { 'foo' => 'bar' }
43
+      agent.should be_valid
44
+    end
45
+
46
+    it "should validate basic_auth" do
47
+      agent.options['basic_auth'] = "foo:bar"
48
+      agent.should be_valid
49
+
50
+      agent.options['basic_auth'] = ["foo", "bar"]
51
+      agent.should be_valid
52
+
53
+      agent.options['basic_auth'] = ""
54
+      agent.should be_valid
55
+
56
+      agent.options['basic_auth'] = nil
57
+      agent.should be_valid
58
+
59
+      agent.options['basic_auth'] = "blah"
60
+      agent.should_not be_valid
61
+
62
+      agent.options['basic_auth'] = ["blah"]
63
+      agent.should_not be_valid
64
+    end
65
+  end
66
+end

+ 9 - 0
spec/support/vcr_support.rb

@@ -0,0 +1,9 @@
1
+require 'vcr'
2
+
3
+VCR.configure do |c|
4
+  c.cassette_library_dir = 'spec/cassettes'
5
+  c.allow_http_connections_when_no_cassette = true
6
+  c.hook_into :webmock
7
+  c.default_cassette_options = { record: :new_episodes}
8
+  c.configure_rspec_metadata!
9
+end

Merge pull request #1106 from dsander/fix-beeper-agent-spec · ee576ffac4 - Gogs J1X

Merge pull request #1106 from dsander/fix-beeper-agent-spec

Fix BeeperAgent spec by requiring rails_helper

Dominik Sander 10 years ago
parent
commit
ee576ffac4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      spec/models/agents/beeper_agent_spec.rb

+ 1 - 1
spec/models/agents/beeper_agent_spec.rb

@@ -1,4 +1,4 @@
1
-require 'spec_helper'
1
+require 'rails_helper'
2 2
 
3 3
 
4 4
 describe Agents::BeeperAgent do